//
//  FiXiViewController.m
//  10-10
//
//  Created by 钟纪旺 on 16/12/5.
//  Copyright © 2016年 zjw. All rights reserved.
//

#import "FiXiViewController.h"
#import "FuXiCollectionViewCell.h"
@interface FiXiViewController ()
    <UICollectionViewDelegate,UICollectionViewDataSource>{
    
    UICollectionView *collectionview;
    UICollectionViewFlowLayout *layout;
}



@end

@implementation FiXiViewController
static NSString *const Identifier = @"cell2";
- (void)viewDidLoad {
    [super viewDidLoad];
    layout = [[UICollectionViewFlowLayout alloc]init];
    layout.itemSize = self.view.frame.size;
    layout.minimumLineSpacing = 0;
    layout.minimumInteritemSpacing = 0;
    layout.scrollDirection =UICollectionViewScrollDirectionHorizontal;
    collectionview = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout];
    collectionview.delegate =self;
    collectionview.dataSource =self;
    collectionview.pagingEnabled =YES;
    
    [self.view addSubview:collectionview];
    [collectionview registerClass:[FuXiCollectionViewCell class] forCellWithReuseIdentifier:Identifier];
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.imagess.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    FuXiCollectionViewCell *cell = [collectionview dequeueReusableCellWithReuseIdentifier:Identifier forIndexPath:indexPath];
    cell.imagVi.image = self.imagess[indexPath.item];
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    [self dismissViewControllerAnimated:YES completion:nil];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
